package request

import "github.com/astaxie/beego/validation"

type StoreProductAttrRequest struct {
	Id        uint   `json:"id"`                            //attrID|新增时不填，修改时必填
	AttrName  string `json:"attrName" binding:"required"`   //属性名
	AttrValue string `json:"attrValues" binding:"required"` //属性值|逗号分隔
}

func (p *StoreProductAttrRequest) Valid(v *validation.Validation) {
	if p.AttrName == "" {
		v.SetError("AttrName", "属性名不能为空")
	} else if p.AttrValue == "" {
		v.SetError("AttrValue", "属性值不能为空")
	}
}
